<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateQhUserHasQuestionLibrariesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('qh_user_has_question_libraries', function (Blueprint $table) {
            $table->id();
            $table->integer('userId', false, true)->comment('用户ID');
            $table->integer('qlId', false, true)->comment('题库ID');
            $table->tinyInteger('type', false, true)->nullable()->comment('来源，1：直接购买，2：激活码兑换');
            $table->timestamps();
        });

        DB::statement("ALTER TABLE qh_user_has_question_libraries comment '用户购买的题库'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('qh_user_has_question_libraries');
    }
}
